package cn.mo.dq.nacosconfig.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with hz
 *
 * @Author: hz
 * @Date: 2023/04/08/22:07
 * @Description:
 */
@RestController
@RequestMapping("config")
public class ConfigController {
    @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
    private boolean useLocalCache;

    @NacosValue(value = "${config.text}", autoRefreshed = true)
    private String nacosConfig;

    @GetMapping("/get")
    @ResponseBody
    public boolean get() {
        return useLocalCache;
    }

    @GetMapping("/getConfig")
    @ResponseBody
    public String getConfig() {
        return nacosConfig;
    }
}
